import { reqBanners } from "@/api";

const state = {
    banners: [],
};

const getters = {};

const mutations = {
    // 获取轮播图
    GET_BANNERS(state, { banners }) {
        state.banners = banners;
    },
};

const actions = {
    // 获取三级列表
    getBanners({ commit }) {
        reqBanners().then(response => {
            commit("GET_BANNERS", { banners: response });
        });
    },
};

export default {
    namespaced: true, // 开启命名空间
    state,
    getters,
    mutations,
    actions,
};
